home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Snippets / Development Tools & Languages / DTSCPlusLibrary / Sources / SpinCursor.h < prev    next >
Encoding:
Text File  |  1993-01-14  |  2.9 KB  |  96 lines  |  [TEXT/MPS ]

  1. /* _________________________________________________________________________________________________________ //
  2.   Copyright © 1992-93 Apple Computer, Inc. All rights reserved.
  3.   Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  4.   Programmer: Kent Sandvik
  5.   Date: 12/14/92
  6.   Revision comments are at the end of this file.
  7.   ---
  8.   TSpinCursor is a simple cursor spinning class.
  9.   SpinCursor.h contains the TSpinCursor class definition.
  10.   _________________________________________________________________________________________________________ */
  11.  
  12. // Declare label for this header file
  13. #ifndef _SPINCURSOR_
  14. #define _SPINCURSOR_
  15.  
  16. #ifndef _DTSCPLUSLIBRARY_
  17. #include "DTSCPlusLibrary.h"
  18. #endif
  19.  
  20.  
  21. // TOOLBOX INTERFACES
  22. #ifndef __QUICKDRAW__
  23. #include <Quickdraw.h>
  24. #endif
  25.  
  26. #ifndef __RESOURCES__
  27. #include <Resources.h>
  28. #endif
  29.  
  30. #ifndef __MEMORY__
  31. #include <Memory.h>
  32. #endif
  33.  
  34. #ifndef __TOOLUTILS__
  35. #include <ToolUtils.h>
  36. #endif
  37.  
  38.  
  39. // _________________________________________________________________________________________________________ //
  40. //    TSpinCursor Class Interface.
  41.  
  42. class TSpinCursor
  43. // TSpinCursor is a simple cursor spinning/controlling class, that will bind the CURS and 'acur' resources
  44. // specified, and animate the cursor to either direction based on the 'acur' list.
  45. {
  46. public:
  47.     // ENUMS AND TYPEDEFS
  48.     enum EDirection                                // our cursor spinning direction
  49.     {
  50.         kBackwards = -1, kForwards = 1
  51.     };
  52.  
  53.     // CONSTRUCTORS AND DESTRUCTORS
  54.     TSpinCursor(short acurID,                    // the 'acur' resource used
  55.                 short SpinDirection = kForwards,// spindirection (default forwards)
  56.                 short spinTicks = 60);            // amount of ticks between spins (1 second default)
  57.     virtual~ TSpinCursor();
  58.  
  59.     // MAIN INTERFACE
  60.     virtual void Spin();                        // start spinning
  61.     virtual void SetSpinDirection(EDirection);    // change directions    
  62.     // INTERNAL STRUCTS
  63.     struct AnimationCursRec                        // structure needed to map the 'acur' resource to a data structure
  64.     {
  65.         struct
  66.         {
  67.             unsigned short hasColor:1;            // if true uses color cursors
  68.             unsigned short count:15;            // # of frames in the cursor list
  69.         } information;
  70.         short frame;                            // cursor index list of next cursor frame
  71.         CursHandle nCursors[20];                // list of cursor handles
  72.     };
  73.  
  74.     // FIELDS
  75. protected:CursHandle fCursorHandle;                // reference to our cursor handle
  76.     short fCursorID;                            // ID of the CURS resource
  77.     short fIndex;                                // index to the animated cursor list
  78.     short fSpinDirection;                        // 1 = forward, -1 backwards, 2 skip every 2 frames…
  79.     AnimationCursRec * *fCursorList;            // list of cursors we will use
  80.     long fTickCounter;                            // our Tick counter
  81.     short fSpinTicks;                            // amount of ticks between spins
  82.     OSErr fError;                                // latest error
  83. };
  84.  
  85.  
  86. #endif
  87.  
  88. // _________________________________________________________________________________________________________ //
  89.  
  90.  
  91. /*    Change History (most recent last):
  92.   No        Init.    Date        Comment
  93.   1            khs        12/14/92    New file
  94.   2            khs        1/3/93        Cleanup
  95. */
  96.